package app

import (
	"cloud-navigation/app/common/response"
	"cloud-navigation/app/services"
	"time"

	"github.com/gin-gonic/gin"
)

// 获取服务器时间
func ServerTime(c *gin.Context) {
	time := time.Now().UnixMilli()
	response.Success(c, time)
}

// 获取验证码
func GetCaptcha(c *gin.Context) {
	code, captcha, err := services.CreateCaptcha("string", 5*60, 4)
	if err != nil {
		response.BusinessFail(c, err.Error())
		return
	}
	response.Success(c, gin.H{"code": code, "captcha_img": captcha})
}
